package org.linlinjava.litemall.db.service;

import org.linlinjava.litemall.db.dao.AgedmallGoodsServiceMapper;
import org.linlinjava.litemall.db.domain.AgedmallGoodsService;
import org.linlinjava.litemall.db.domain.AgedmallGoodsServiceExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AgedmallGoodsServiceService {
    @Resource
    private AgedmallGoodsServiceMapper agedmallGoodsServiceMapper;

    public List<AgedmallGoodsService> getByGoodsId(Integer goodsId) {
        AgedmallGoodsServiceExample example = new AgedmallGoodsServiceExample();
        example.or().andDeletedEqualTo(false)
                .andGoodsIdEqualTo(goodsId);
        return agedmallGoodsServiceMapper.selectByExample(example);
    }

    public AgedmallGoodsService getByProductId(Integer productId) {
        AgedmallGoodsServiceExample example = new AgedmallGoodsServiceExample();
        example.or().andDeletedEqualTo(false)
                .andProductIdEqualTo(productId);
        return agedmallGoodsServiceMapper.selectOneByExample(example);
    }
}
